package com.springapp.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;


public class Log4jUtil {
	
	public static void getLog4jPro(){
	
		
		String path=System.getProperty("user.dir"); 
		Properties pro = new Properties();
		FileInputStream in;
		FileOutputStream out;
		try {
			in = new FileInputStream(path+File.separator+"properties"+File.separator+"log4j.properties");
			pro.load(in);
			out=new FileOutputStream(path+File.separator+"properties"+File.separator+"log4j.properties");
			pro.setProperty("log4j.appender.E.File", path+File.separator+"logs"+File.separator+"CollectEmcHigh_log_");
			pro.store(out,"last update");

			in.close();
			out.close();
			
			in=new FileInputStream(path+File.separator+"properties"+File.separator+"log4j.properties");
			pro.load(in);
			in.close();
			Debug.echo(pro.getProperty("log4j.appender.E.File"));
			
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}

}
